<template>
  <!-- 出入境人员页面 -->
  <div class="container">
    <div class="section-wrap left-section">
      <div class="section section01">
        <border-wrap>
          <div class="title"><h2>性别分布</h2></div>
          <div class="content">
            <div class="s1-content">
              <div class="sex-ratio">
                <div class="title"><span>上月</span></div>
                <div class="sex-ratio-content">
                  <div class="ratio-total">
                    <b>1,666</b>
                    <span>出入境人员总数（个）</span>
                  </div>
                  <div class="ratio-chart">
                    <sex-ratio
                      :data="sexData01"
                    ></sex-ratio>
                  </div>
                </div>
              </div>
              <div class="sex-ratio">
                <div class="title"><span>本年</span></div>
                <div class="sex-ratio-content">
                  <div class="ratio-total">
                    <b>1,666</b>
                    <span>出入境人员总数（个）</span>
                  </div>
                  <div class="ratio-chart">
                    <sex-ratio
                      :data="sexData02"
                    ></sex-ratio>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </border-wrap>
      </div>
      <div class="section section02">
        <border-wrap>
          <div class="title"><h2>地区分布</h2></div>
          <div class="content">
            <div class="s2-content">
              <div class="rank-chart-section">
                <div class="tab-list">
                  <div class="neu-tab-list item-start border-none text-start">
                    <div class="tab-item active"><span>本年度出入境人员地区top5</span></div>
                  </div>
                </div>
                <div class="rank-chart-content">
                  <div class="rank-content">
                    <rank-list
                      :dataList="rankData01"
                      size="small"
                    ></rank-list>
                  </div>
                  <div class="chart-content">
                    <div class="neu-pie-chart">
                      <div class="chart-detail">
                        <span>南宁进口总量</span>
                        <b>148,6586</b>
                      </div>
                      <div class="chart-content">
                        <div class="chart-content-main" id="s2PieChart"></div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </border-wrap>
      </div>
      <div class="section section03">
        <border-wrap>
          <div class="title"><h2>种类分布</h2></div>
          <div class="content">
            <div class="s3-content">
              <div class="swiper-container">
                  <div class="swiper-wrapper">
                      <div class="swiper-slide" v-for="item,index in swiperList" :key="item.name">
                        <div class="swiper-item">
                          <div class="swiper-title"><span>No.{{index+1}}</span>{{item.value}}%</div>
                          <div class="swiper-content">
                            <div class="swiper-name">{{item.name}}</div>
                          </div>
                        </div>
                      </div>
                  </div>
                  <!-- 如果需要分页器 -->
                  <div class="swiper-pagination neu-swiper-pagination"></div>
              </div>
            </div>
          </div>
        </border-wrap>
      </div>
    </div>
    <div class="section-wrap middle-section">
      <div class="section06">
        <div class="s6-content">
          <div class="s6-target">
            <div class="target-icon"></div>
            <div class="target-info">
              <h2>出入境比</h2>
              <b>1:2</b>
            </div>
          </div>
          <div class="s6-target">
            <div class="target-icon"></div>
            <div class="target-info">
              <h2>男女比</h2>
              <b>1:2</b>
            </div>
          </div>
          <div class="s6-target">
            <div class="target-icon"></div>
            <div class="target-info">
              <h2>非法出入境人员比例</h2>
              <b>1:2</b>
            </div>
          </div>
          <div class="s6-target">
            <div class="target-icon"></div>
            <div class="target-info">
              <h2>出入境人群分类比</h2>
              <b>1:2</b>
            </div>
          </div>
          <div class="s6-target">
            <div class="target-icon"></div>
            <div class="target-info">
              <h2>人数与客流比</h2>
              <b>1:2</b>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="section-wrap right-section">
      <div class="section section04">
        <border-wrap>
          <div class="title"><h2>客流量</h2></div>
          <div class="content">
            <div class="s4-content">
              <div class="target-list">
                <div class="target-item" v-for="item in targetList" :key="item.name">
                  <div class="neu-table-data-card">
                    <div class="card-icon card-ceil"><img src="../../assets/images/icon-airplane.png" alt=""></div>
                    <div class="card-total card-ceil">
                      <h2>{{item.value}}</h2>
                      <small>{{item.name}}</small>
                    </div>
                    <div class="card-percent card-ceil">
                      <h2>
                        <i :class="['iconfont', {'icon-arrow':item.status,'icon-arrow-down':!item.status}]"></i>
                        <span>{{item.percent}}%</span>
                      </h2>
                      <small>同比</small>
                    </div>
                    <div class="card-percent card-ceil">
                      <h2>
                        <i :class="['iconfont', {'icon-arrow':item.status2,'icon-arrow-down':!item.status2}]"></i>
                        <span>{{item.percent2}}%</span>
                      </h2>
                      <small>环比</small>
                    </div>
                  </div>
                </div>
              </div>
              <div class="s4-chart" id="s4MainChart"></div>
            </div>
          </div>
        </border-wrap>
      </div>
      <div class="section section05">
        <border-wrap>
          <div class="title"><h2>非法出入境</h2></div>
          <div class="content">
            <div class="s5-content" id="s5MainChart"></div>
          </div>
        </border-wrap>
      </div>
    </div>
  </div>
</template>

<script>
import Swiper from 'swiper';
import borderWrap from '../../components/commons/borderWrap.vue';
import rankList from '../../components/commons/rankList.vue';
import sexRatio from '../../components/commons/sexRatio.vue';
import {
  createLineBarChart,
  createPieChart,
  createGradientColor
} from '../../utils/plugins/common'
export default {
  name: "churujingRenkou",
  components:{
    borderWrap,
    rankList,
    sexRatio
  },
  data(){
    return {
      swiperList:[{
        name:"旅游",
        value:50
      },{
        name:"学习",
        value:40
      },{
        name:"商务",
        value:30
      },{
        name:"移民",
        value:20
      },{
        name:"家属",
        value:10
      },{
        name:"交流",
        value:9
      },{
        name:"娱乐",
        value:8
      },{
        name:"文化",
        value:7
      },{
        name:"生活",
        value:7
      },{
        name:"其他",
        value:6
      }],
      sexData01:{
        male:1000,
        female:500
      },
      sexData02:{
        male:500,
        female:500
      },
      targetList:[{
        name:"上月客流总数量",
        value:21666,
        percent:34,
        percent2:26,
        status:0,
        status2:1
      },{
        name:"本年客流总数量",
        value:21666,
        percent:34,
        percent2:26,
        status:0,
        status2:1
      }],
      rankData01:[{
        name:"矿石",
        percent:{
          value:23,
          status:1
        },
        value:1000
      },{
        name:"矿石",
        percent:{
          value:23,
          status:1
        },
        value:1000
      },{
        name:"矿石",
        percent:{
          value:23,
          status:0
        },
        value:1000
      },{
        name:"矿石",
        percent:{
          value:23,
          status:0
        },
        value:1000
      },{
        name:"矿石",
        percent:{
          value:23,
          status:0
        },
        value:1000
      }]
    }
  },
  mounted(){
    new Swiper ('.swiper-container', {
      slidesPerView: 4,
      spaceBetween: 20,
      autoplay:{
        delay:3000,
        disableOnInteraction: false
      },
      loop: false,
      // 如果需要分页器
      pagination: {
        el: '.swiper-pagination',
        clickable: true
      },
    })        
    createPieChart({
      id:"s2PieChart",
      config:{
        data:[{
          name:"aaa",
          value:10
        },{
          name:"bbb",
          value:10
        },{
          name:"ccc",
          value:10
        },{
          name:"ddd",
          value:10
        },{
          name:"eee",
          value:10
        },{
          name:"fff",
          value:10
        }]
      },
      option:{
        color:["#C4292D","#D87D30","#DFAA04","#5287D0","#55ABB7","#49759B"],
        series: {
          radius: ['170%', '200%']
        }
      }
    })
    createLineBarChart({
      id:"s5MainChart",
      config:{
        title:"非法出入境人数趋势",
        xAxisData:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],
        data:[{
          type:"line",
          area:true,
          areaColor:createGradientColor("toBottom",["rgba(3, 112, 255, 0.5)","rgba(3, 112, 255, 0)"]),
          name:"非法入境",
          data:[200,210,178,197,398,456,221,150,199,299,456,221]
        },{
          type:"line",
          area:true,
          areaColor:createGradientColor("toBottom",["rgba(0, 211, 114, 0.5)","rgba(0, 211, 114, 0)"]),
          name:"非法离境",
          data:[100,110,78,97,298,256,121,50,99,99,256,121]
        }]
      },
      option:{
        title:{
          left:"center"
        },
        color:["rgba(0, 187, 255, .8)","rgba(0, 211, 114, .8)"],
        grid:{
          top: "26%"
        }
      }
    })
    createLineBarChart({
      id:"s4MainChart",
      config:{
        title:"客流量趋势",
        barWidth:20,
        xAxisData:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],
        data:[{
          type:"bar",
          name:"非法入境",
          borderRadius:null,
          data:[200,210,178,197,398,456,221,150,199,299,456,221]
        }]
      },
      option:{
        color:[createGradientColor("toBottom",["rgba(13, 204, 255, 0.5)","rgba(71, 96, 255, 1)"])],
        legend:{
          show:false
        },
        grid:{
          top: "20%"
        }
      }
    })
  }
}
</script>

<style lang="scss" scoped>
.container{
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .section-wrap{
    width: calc((100% - 40px)/3);
    height: 100%;
    .section{
      div.title{
        h2{
          height: 30px;
          padding-left: 20px;
          line-height: 30px;
          font-size: 16px;
        }
      }
      div.content{
        box-sizing: border-box;
        width: 100%;
        height: calc(100% - 30px);
        box-sizing: border-box;
        padding: 20px;
      }
    }
    &.left-section{
      .section{
        height: calc((100% - 40px)/3);
      }
      .section01{
        
        .s1-content{
          // opacity: 0;
          height: 100%;
          display: flex;
          flex-direction: column;
          justify-content: center;
          align-items: center;
          .sex-ratio{
            height: 50%;
            width: 100%;
            margin-top: 10px;
            &:first-child{
              margin-top: 0;
            }
            .title{
              height: 30px;
              text-align: left;
              span{
                width: 50px;
                height: 30px;
                line-height: 30px;
                text-align: center;
                display: inline-block;
                box-sizing: border-box;
                background: linear-gradient(0deg, rgba(8,60,151,0.8) 0%, rgba(50,124,254,0) 30%);
              }
            }
            .sex-ratio-content{
              display: flex;
              justify-content: space-between;
              align-items: center;
              .ratio-total{
                width: 120px;
                height: 80px;
                display: flex;
                flex-direction: column;
                justify-content: center;
                align-items: center;
                // border-right: 1px solid rgba(153, 228, 255, .5);
                padding-right: 15px;
                position: relative;
                b{
                  color: #00FFFF;
                  font-size: 20px;
                  margin-bottom: 8px;
                }
                span{
                  font-size: 12px;
                }
                &::after{
                  content:"";
                  position: absolute;
                  width: 1px;
                  height: 50px;
                  background: rgba(153, 228, 255, .5);
                  top: 50%;
                  right: 0;
                  transform: translate(0,-50%);
                }
              }
              .ratio-chart{
                flex-grow: 1;
                margin-left: 15px;
              }
            }
          }
        }
      }
      .section02{
        margin: 20px 0;
        .s2-content{
          // opacity: 0;
          height: 100%;
          .rank-chart-section{
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            .tab-list{
              width: 100%;
              height: 30px;
              margin-bottom: 20px;
              .tab-item{
                width: 200px;
                padding: 0;
              }
            }
            .rank-chart-content{
              width: 100%;
              height: 160px;
              display: flex;
              justify-content: space-between;
              align-items: center;
              .rank-content{
                flex-grow: 1;
                margin-right: 40px;
                height: 100%;
              }
              .chart-content{
                display: flex;
                justify-content: center;
                align-items: center;
                width: 160px;
                height: 160px;
                .chart-content-main{
                  width: 140px;
                  height: 140px;
                }
              }
            }
          }
        }
      }
      .section03{
        .s3-content{
          box-sizing: border-box;
          height: 100%;
          display: flex;
          justify-content: center;
          align-items: center;
          .swiper-container{
            height: 100%;
          }
          .swiper-slide{
            &:nth-child(odd){
              .swiper-item{
                .swiper-title{
                  span{
                    color: #52EEE8;
                  }
                }
                .swiper-content{
                  background: url(../../assets/images/swiper-bg02.png) no-repeat top center / 100% auto;
                  .swiper-name{
                    color: #52EEE8;
                  }
                }
              }
            }
            .swiper-item{
              width: 100%;
              .swiper-title{
                text-align: center;
                font-size: 16px;
                margin-bottom: 10px;
                span{
                  color: #52C5EE;
                  margin-right: 6px;
                  font-weight: bold;
                }
              }
              .swiper-content{
                height: 160px;
                overflow: hidden;
                position: relative;
                background: url(../../assets/images/swiper-bg01.png) no-repeat top center / 100% auto;
                .swiper-name{
                  position: absolute;
                  top: 0;
                  left: 0;
                  width: 100%;
                  height: 126px;
                  font-size: 20px;
                  color: #52C5EE;
                  display: flex;
                  justify-content: center;
                  align-items: center;
                }
              }
            }
          }
          
        }
      }
    }
    &.middle-section{
      margin: 0 20px;
      .section06{
        height: 100%;
        background: url(../../assets/images/main-bg.webp) no-repeat center center / contain;
        display: flex;
        justify-content: center;
        align-items: center;
        .s6-content{
          width: 600px;
          height: 600px;
          position: relative;
          .s6-target{
            display: flex;
            justify-content: center;
            align-items: center;
            position: absolute;
            .target-icon{
              width: 56px;
              height: 56px;
              background-image: url(../../assets/images/icon-inout01.png);
              background-repeat: no-repeat;
              background-position: center;
              background-size: contain;
            }
            &:nth-child(1){
              top: 0px;
              left: 50%;
              .target-icon{
                background-image: url(../../assets/images/icon-inout01.png);
              }
            }
            &:nth-child(2){
              top: 20%;
              right: 0;
              .target-icon{
                background-image: url(../../assets/images/icon-inout02.png);
              }
            }
            &:nth-child(3){
              bottom: 10%;
              right: 0;
              .target-icon{
                background-image: url(../../assets/images/icon-inout03.png);
              }
            }
            &:nth-child(4){
              bottom: 0;
              left: 10%;
              .target-icon{
                background-image: url(../../assets/images/icon-inout04.png);
              }
            }
            &:nth-child(5){
              top: 10%;
              left: 0;
              .target-icon{
                background-image: url(../../assets/images/icon-inout05.png);
              }
            }
            .target-info{
              display: flex;
              flex-direction: column;
              justify-content: center;
              align-items: center;
              position: relative;
              padding: 10px 20px;
              background: url(../../assets/images/item-bg.png) no-repeat center center / 100% 100%;
              h2{
                font-size: 14px;
              }
              b{
                font-size: 20px;
                color: #00FFFF;
              }
              &::after{
                content:"";
                width: 0;
                height: 0;
                border: 7px solid transparent;
                border-left-color: #023B9E;
                position: absolute;
                top: 50%;
                left: 3px;
                transform: translate(0,-50%);
              }
            }
          }
        }
      }
    }
    &.right-section{
      .section04{
        height: calc((100% - 40px)/3*2 + 20px);
        .s4-content{
          height: 100%;
          .target-list{
            .target-item{
              height: 110px;
              margin-top: 20px;
              &:first-child{
                margin-top: 0;
              }
              .card-ceil{
                width: 25%;
              }
            }
          }
          .s4-chart{
            height: calc(100% - 280px);
            margin-top: 40px;
          }
        }
      }
      .section05{
        height: calc((100% - 40px)/3);
        margin-top: 20px;
        .s5-content{
          height: 100%;
        }
      }

    }
  }
}
</style>